using UnityEngine;

public class ChatInGameUIChatMessage : MonoBehaviour
{
	public UIWidget container;

	public UIWidget holder;

	public UILabel messageText;

	public UISprite myMessageBG;

	public UISprite otherMessageBG;

	public bool isMine;

	public ChatInGameUIChatMessage SetMessageUI(bool isMine, string text, PunTeams.Team myTeam, PunTeams.Team team)
	{
		this.isMine = isMine;
		messageText.text = text;
		if (isMine)
		{
			container.pivot = UIWidget.Pivot.Right;
			holder.pivot = UIWidget.Pivot.Right;
			holder.transform.localPosition = new Vector3(-15f, 0f, 0f);
			myMessageBG.flip = UIBasicSprite.Flip.Nothing;
			myMessageBG.gameObject.SetActive(true);
			otherMessageBG.gameObject.SetActive(false);
		}
		else
		{
			container.pivot = UIWidget.Pivot.Left;
			holder.pivot = UIWidget.Pivot.Left;
			holder.transform.localPosition = new Vector3(15f, 0f, 0f);
			otherMessageBG.flip = UIBasicSprite.Flip.Nothing;
			myMessageBG.gameObject.SetActive(false);
			otherMessageBG.gameObject.SetActive(true);
			if (myTeam != 0 && team != 0)
			{
				messageText.color = ((myTeam != team) ? Color.red : Color.blue);
			}
		}
		return this;
	}
}
